#ifndef MESSAGEITEM_H
#define MESSAGEITEM_H

#include <QWidget>
#include "model/data.h"
#include <QGridLayout>
#include <QPushButton>
#include <QLabel>
#include "debug.h"
#include "messagecontentlabel.h"
#include "model/data.h"
#include "userinfowidget.h"


class MessageItem : public QWidget
{
    Q_OBJECT
public:
    MessageItem(bool isLeft);
    static MessageItem* makeMessageItem(bool isLeft, const model::Message& message);

private:
    //创建消息体函数
    static QWidget* makeTextMessageItem(const QByteArray& content, bool isLeft);
    static QWidget* makeImageMessageItem(const QString& fileId, const QByteArray& content, bool isLeft);
    static QWidget* makeFileMessageItem(const QString& fileId, const QByteArray& content, bool isLeft, const QString& fileName);
    static QWidget* makeSoundMessageItem(const QString& fileId, const QByteArray& content, bool isLeft);

    bool isleft;
};

#endif // MESSAGEITEM_H
